package com.douma.第22天;

import java.util.Scanner;

/**
 * 抖码算法，让算法学习变的简单有趣
 *
 * @作者 : 老汤
 */
public class 转骰子 {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String s = sc.nextLine();

        String res = "123456";  //骰子的初始状态

        for (int i = 0; i < s.length(); i++) {
            res = zhuanSZ(String.valueOf(s.charAt(i)), res);
        }

        System.out.println(res);
    }

    // 根据指定的翻转方向，重新计算骰子的状态
    public static String zhuanSZ(String flipDirection, String sz) {

        // 需要将char转成sting，否则会变成ASCII码值的和
        String s1 = String.valueOf(sz.charAt(0));
        String s2 = String.valueOf(sz.charAt(1));
        String s3 = String.valueOf(sz.charAt(2));
        String s4 = String.valueOf(sz.charAt(3));
        String s5 = String.valueOf(sz.charAt(4));
        String s6 = String.valueOf(sz.charAt(5));

        // 骰子转向各个方向的重新排序
        switch (flipDirection) {
            case "L":
                return s5 + s6 + s3 + s4 + s2 + s1;
            case "R":
                return s6 + s5 + s3 + s4 + s1 + s2;
            case "F":
                return s1 + s2 + s5 + s6 + s4 + s3;
            case "B":
                return s1 + s2 + s6 + s5 + s3 + s4;
            case "A":
                return s4 + s3 + s1 + s2 + s5 + s6;
            case "C":
                return s3 + s4 + s2 + s1 + s5 + s6;
        }
        return "";
    }
}
